﻿@model Guan.CMS.Web.ViewModels.ProductCategory.ProductCategoryFormModel

@{
    ViewBag.Title = "编辑分类";
}
@section Styles{
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/select2.css")"/>
    <style>
        #s2id_ParentId{ width: 150px;}
    </style>
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            @if (ViewBag.SectionTitleImage != null)
            {
                <img src="@Url.Content("~/Content/Images/Admin/" + ViewBag.SectionTitleImage)" alt="" />
            }
            @ViewBag.Title
        </div>
        <div class="options">
            <input type="submit" value="保存" class="k-button"/>
            <a href="@Url.Action("Delete","ProductCategory",new{id=Model.Id})" class="k-button" id="btnDelete">删除</a>
        </div>
    </div>
    <div class="section-body">
        @Html.HiddenFor(m => m.Id)
        <table class="main">
            <tr>
                <th>@Html.LabelFor(model => model.Name)</th>
                <td>
                    @Html.TextBoxFor(model => model.Name,new{@class="k-textbox",style="width:500px;"})
                    @Html.ValidationMessageFor(model => model.Name)
                </td>
            </tr>
            <tr>
                <th>@Html.LabelFor(model => model.ParentId)</th>
                <td>
                    @Html.DropDownList("ParentId")
                </td>
            </tr>
        </table>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script type="text/javascript" src="@Url.Content("~/Scripts/select2.min.js")"></script>
    <script type="text/javascript">
        $(function() {
            $("#btnDelete").click(function(e) {
                if (!confirm("确定删除？")) {
                    e.preventDefault();
                }
            });
            $("#ParentId").select2();
        });
    </script>
}